#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>

using namespace std;

int main()
{
	int year = 0, month = 1, day = 0;
	cin >> year >> day;
	int date[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
	while (day > date[month - 1])
	{
		day = day - date[month - 1];
		if (month == 2 && (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)))
		{
			--day;
		}
		++month;
		if (month > 12)
		{
			++year;
			month = 1;
		}
	}
	printf("%04d-%02d-%02d\n", year, month, day);
}